<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>投诉记录修改</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">

<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/index.css">
<script src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/index.js"></script>

<!--<style>
        .imgs{display: none;}
        .picture{display: none;}
    </style>-->

<!--百度编辑器-->
<script src="./ueditor/ueditor.config.js"></script>
<script src="./ueditor/ueditor.all.min.js"></script>
<script src="./ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>

	<div class="layui-card">
		<form class="layui-form layui-form-pane"
			action="${pageContext.request.contextPath}/ComplaintServlet"
			id="update-form" method="post">
			<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
				<ul class="layui-tab-title">
					<li class="layui-this">基本信息</li>
				</ul>

				<div class="layui-tab-content">
					<div class="layui-tab-item layui-show">
						<input type="hidden" name="op" value="update">
						<div class="layui-form-item">
							<label class="layui-form-label"> <span class='x-red'>*</span>投诉编号
							</label>
							<div class="layui-input-block">
								<input type="text" name="comNo" autocomplete="off" value=""
									readonly="readonly" class="layui-input" required="required">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label"> <span class='x-red'>*</span>房间号
							</label>
							<div class="layui-input-block">
								<input type="text" name="roomNo" autocomplete="off" value=""
									class="layui-input" required="required" readonly="readonly">
								<!-- readonly只读 -->
							</div>
						</div>


						<div class="layui-form-item">
							<label class="layui-form-label"> <span class='x-red'>*</span>投诉时间
							</label>
							<div class="layui-input-block">
								<input type="text" name="comTime" autocomplete="off" value=""
									class="layui-input" required="required" readonly="readonly">
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label"> <span class='x-red'>*</span>投诉内容
							</label>
							<div class="layui-input-block">
								<input type="text" name="comcontent" autocomplete="off" value=""
									class="layui-input" required="required">
							</div>
						</div>

					
							<div class="layui-form-item">
							<label class="layui-form-label"> <span class='x-red'>*</span>投诉状态
							</label>
							<div class="layui-input-block">
								<input type="text" name="comZhuangTai" autocomplete="off" value=""
									class="layui-input" required="required"
									readonly="readonly">
							</div>
						</div>

						<div class="layui-form-item">
							<button class="layui-btn" type="submit" lay-filter="add"
								lay-submit="">修改投诉信息</button>
						</div>
						<!--</form>-->
						<div style="height: 100px;"></div>
					</div>


				</div>

			</div>
		</form>
	</div>
	<script type="text/javascript"
		src="${pageContext.request.contextPath}/back/js/jquery.js"></script>
	<script type="text/javascript"
		src="${pageContext.request.contextPath}/back/js/jquery-form.js"></script>
	<script type="text/javascript">
		/*获取请求路径上携带的商品编号*/
		let comNo = "${param.comNo}";
		layui.use('form', function() {
			var form = layui.form;
		})

		/*发起异步请求单个商品信息*/
		$.getJSON("${pageContext.request.contextPath}/ComplaintServlet", {
			op : "findByComNo",
			comNo : comNo
		}, function(result, status, xhr) {
			//获取商品信息，填充到指定DOM元素上
			let comNo = result.data.comNo;
			let roomNo = result.data.roomNo;
			let comTime = result.data.comTime;
			let comcontent = result.data.comContent;
			let comHandler= result.data.comHandler;

			$("input[name='comNo']").val(comNo);
			$("input[name='roomNo']").val(roomNo);
			$("input[name='comTime']").val(comTime);
			$("input[name='comcontent']").val(comcontent);

			if (comHandler == null || "".equals(comHandler)) {
				$("input[name='comZhuangTai']").val("尊敬的业主，改投诉尚未处理,请耐心等待，感谢您的配合!!!!");
			}

			

		});

		//对指定的表单绑定提交事件
		$("#update-form")
				.submit(
						function() {
							//遗留问题，扁担提交之前应该对输入框进行校验，目前我们只是简单必填属性require
							//..
							//使用JQuery.form.js插件方法ajaxSubmit()异步提交表单
							$(this)
									.ajaxSubmit(
											function(result) {//result请求的数据结果
												layui
														.use(
																'layer',
																function() {
																	if (result.status != 0) {
																		//添加商品成功
																		layer
																				.msg(
																						result.message,
																						{
																							icon : 1,
																							time : 5000
																						});
																		//定时器
																		window.setTimeout(
																						function() {
																							//关闭子窗口
																							var index = parent.layer
																									.getFrameIndex(window.name);
																							parent.layer
																									.close(index);
																							//调用首页的查询方法
																							window.parent
																									.com_search_page();
																						},
																						5000);
																	} else {
																		//添加商品出错
																		layer
																				.msg(
																						result.message,
																						{
																							icon : 5,
																							time : 5000
																						});
																	}

																});

											});
							//限制默认的表单提交
							return false;
						});
	</script>

</body>
</html>